package com.microservice.base;

import com.microservice.base.common.utils.ValidatorUtils;
import net.hasor.spring.boot.EnableHasor;
import net.hasor.spring.boot.EnableHasorWeb;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.Bean;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

import javax.validation.Validator;


@EnableHasor()
@EnableHasorWeb()
@SpringBootApplication
@EnableSwagger2 // 启动swagger注解
@EnableCaching // 开启缓存，需要显示的指定
@MapperScan("com.microservice.base.mapper.*")
public class MicroserviceBaseApplication {

  public static void main(String[] args) {
    SpringApplication.run(MicroserviceBaseApplication.class, args);
  }

  @Bean
  public Validator validator() {
    return ValidatorUtils.getValidator();
  }
}
